/*
 * @Author: 阿芙
 * @Date: 2021-06-15 13:16:32
 * @LastEditTime: 2021-06-25 21:58:10
 * @LastEditors: Please set LastEditors
 * @Description: 
 * @FilePath: /RuoLing-SQL/test/apptest.js
 */
const {createPool} = require("../Index.js")
let config = {
    host:"192.168.50.128",
    user:"root",
    password:"lvdi123",
    database:"ruoling_test",
    connectionLimit : 10,
}
const db = createPool(config);








async function fn (){
    let i = 1;
    printMemoryUsage();
    while(i <= 100){
        i++
       
    let connect =  await db.connect();

    let user6 =  await connect.connect_query_close("insert into sys_user(loginname,loginpwd)values(?,?)",["我在测试2",1])
    

    }
    printMemoryUsage();
}
fn()
// 打印内存占用情况
function printMemoryUsage () {
    var info = process.memoryUsage();
    function mb (v) {
      return (v / 1024 / 1024).toFixed(2) + 'MB';
    }
    console.log('rss=%s, heapTotal=%s, heapUsed=%s', mb(info.rss), mb(info.heapTotal), mb(info.heapUsed));
}

console.log("进程等待")
setInterval(()=>{

    console.log("线程等待完毕")
    printMemoryUsage();
  
  
},1000)